Skip to main content

width

Type

property

Summary

The width of an object is the distance from its left edge to its right edge.

Syntax

set the width of <object> to <numberOfPixels>

Description

Use the width property to determine how much horizontal space an object needs, or to make it wider or narrower.

The width of a card is always the same as the width of its stack window. You can set the width of a card, but doing so has no effect and doesn't change the card's width property.

If you reduce the width of a stack, some objects may end up outside the stack window. These objects are not shown; however, they are still there, and will be displayed if you make the window wide enough.

If the object's lockLocation property is false, when you change its width, it shrinks or grows from the center: the object's left and right edges both shift, while the object's location property stays the same. If the object's lockLocation property is true, it shrinks or grows from the top left corner: the object's left edge stays in the same place, and the right edge moves.

The width of an object cannot be set to zero. Attempting to do so will set the width to 1 instead.

Cross-platform note

On Mac OS and OS X systems, the maximum width of an image is 16384 divided by the screen's bit depth. (For example, if the number of colors is "Millions", the maximum image width is 4096 pixels.)

note

The current architecture uses 16-bit signed integers for all co-ordinates, which means that the value range is -32768 to 32767.

Examples

set the width of the target to 100
set the width of button 1 to the formattedWidth of button 1

object: stack, card

property: backSize, left, titleWidth, orientation, tabStops, pixels, lockLocation, location, hScrollbar, maxWidth

command: revChangeWindowSize

glossary: object, property, bit depth, Mac OS, stack window, OS X

keyword: card, image

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?